package shiro.com.basie.erro;

import lombok.extern.slf4j.Slf4j;
import org.apache.shiro.authz.UnauthenticatedException;
import org.apache.shiro.authz.UnauthorizedException;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;
import shiro.com.basie.domain.Result;

@Slf4j
@RestControllerAdvice
public class GlobalException {
    @ExceptionHandler(value = UnauthorizedException.class)
    public Result hanelder(UnauthorizedException e)
    {
        log.error("运行时异常，没有权限");
        return new Result().setCode(401).setMessage("权限不足");
    }
}
